/*
*********************************************************************************************************
*                                      TRDP-GW main.h
*
*                             (c) Copyright 2015; DL-Laike
*
*                   All rights reserved.  Protected by international copyright laws.
*                   Knowledge of the source code may not be used to write a similar
*                   product.  This file may only be used in accordance with a license
*                   and should not be redistributed in any way.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                        the MAIN
*                             ST Microelectronics STM32 with the STM32F407IGT6
*
* Filename      : main.h
* Version       : V1.0.0
* Programmer(s) : ZhangYu
*********************************************************************************************************
*/

#ifndef MAIN_H
#define MAIN_H

#ifdef __cplusplus
 extern "C" {
#endif

#define USE_USER_H_CONFI	1				//user can configure .h file to configure SD library
#define	USE_SD_RTC_Enable	1
#define	USE_W5500_Enable	1
#define AUTO_DEV_DETECT		0
#define USE_DRG_UART_COM	1
#define USE_SDK_ENABLE		1
#define USE_AUTONEG				1

 /*--------------------------------------------
  * we use CCM memory area for RTOS by default
  * CCM Memory can not be used as the DMA transfer memory
  * thus the application should define the global memory
  * for the data which can be used by DMA
  * by now SDCard and UART is using DMA
 ---------------------------------------------*/
#define osStackSizeSmall	(128)
#define osStackSizeNormal	(512)
#define osStackSizeLarge	(2048)
#define osStackSizeHuge		(4096)
// Priority used for thread control.
typedef enum  {
	osPriorityIdle          =  0,          ///< priority: idle (lowest)
	osPriorityLow           = +1,          ///< priority: low
	osPriorityBelowNormal   = +2,          ///< priority: below normal
	osPriorityNormal        = +3,          ///< priority: normal (default)
	osPriorityAboveNormal   = +4,          ///< priority: above normal
	osPriorityHigh          = +5,          ///< priority: high
	osPriorityRealtime      = +6,          ///< priority: real time (highest)
} osPriority;


#ifndef OK
#define OK          1    /* No error, everything OK. */
#endif

#ifndef ERROR
#define ERROR       0    /* Out of memory error.     */
#endif

#ifndef NULL
#define NULL ((void *)0)
#endif

extern __IO uint32_t localtime;					//LocalTime

//OS resource
extern xSemaphoreHandle xSem_UserData;			//user data access locker
extern xSemaphoreHandle xSem_E2PROM;			//CAN1 Port access locker
extern xSemaphoreHandle xSem_TRDP;				//user data access locker
extern xQueueHandle xQue_CAN2;					//message queue for the CAN2 TASK
extern xQueueHandle xQue_CAN1;					//message queue for the CAN1 TASK
extern xQueueHandle xQue_W5500;					//message queue for W5500
extern xQueueHandle xQue_E2PROM;				//message queue for the SD Card
extern xQueueHandle xQue_RTC;					//message queue for the RTC
/* public functions -----------------------------------------------------------*/
void TASK_InitWork( void *pvParameters );
   
#ifdef __cplusplus
 }
#endif /* C++ */

#endif /* MAIN_H */

/* end of file */
